package com.wxboot.game.eliminate.base;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

import static com.wxboot.game.eliminate.config.JellyConstant.CELL_NUM;

public class JellyContext {

    private JellyCell[][] matrixJellyCell = new JellyCell[CELL_NUM][CELL_NUM];
    private Set<JellyCell> bombed = new HashSet<>();
    private TreeSet<Integer> totalRowBombedSet = new TreeSet<>();
    private int count = 0;

    public JellyCell[][] getMatrixJellyCell() {
        return matrixJellyCell;
    }

    public void setMatrixJellyCell(JellyCell[][] matrixJellyCell) {
        this.matrixJellyCell = matrixJellyCell;
    }

    public Set<JellyCell> getBombed() {
        return bombed;
    }

    public void setBombed(Set<JellyCell> bombed) {
        this.bombed = bombed;
    }

    public TreeSet<Integer> getTotalRowBombedSet() {
        return totalRowBombedSet;
    }

    public void setTotalRowBombedSet(TreeSet<Integer> totalRowBombedSet) {
        this.totalRowBombedSet = totalRowBombedSet;
    }

    public int getCount() {
        return count;
    }

    public void incrCount() {
       this.count++;
    }

    public String getMatrix() {
        StringBuilder matrix = new StringBuilder();
        for (int i = 0; i < matrixJellyCell.length; i++) {
            for (int j = 0; j < matrixJellyCell[i].length; j++) {
                matrix.append(matrixJellyCell[i][j]);
            }

            if (i < matrixJellyCell.length - 1) {
                matrix.append("\n");
            }
        }

        return matrix.toString();
    }

}
